package com.hxkj.controller.article;

import com.hxkj.domain.po.SiteUniversal;
import com.hxkj.service.article.UniversalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.Callable;

/**
 * 网站管理控制层
 * <p>
 * Created by yaosy on 2018年6月14日19:28:33
 */
@RestController
@RequestMapping("/universal")
public class UniversalController {

    @Autowired
    private UniversalService universalService;


    /**
     * 获取单条站点信息数据
     *
     * @param siteUniversal
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/get")
    public Callable<SiteUniversal> get(@ModelAttribute SiteUniversal siteUniversal) throws Exception {
        return () ->universalService.get(siteUniversal);
    }

    /**
     * 保存单条站点信息
     *
     * @param siteUniversal
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/modify")
    public void modify(@ModelAttribute SiteUniversal siteUniversal) throws Exception {
        universalService.modify(siteUniversal);
    }
}
